//
//  BLAppLaunchingProcess.m
//  BasketBallLeagues
//
//  Created by kenshin on 4/23/17.
//  Copyright © 2017 kenshin. All rights reserved.
//

#import "BLAppLaunchingProcess.h"

#import "SystemHelper.h"
#import <UMMobClick/MobClick.h>
#import <Bugtags/Bugtags.h>
#import "DCLoggerConfig.h"
#import "BLUMSocialManager.h"
#import <Bugly/Bugly.h>
//友盟
#define kUMeng_Appkey @""
#define kUMeng_AppSecret @""
//Bugtags
#define kBugtags_Appkey @"db7772ebcb1b8678fb6ae078ee3eaeef"
#define kBugtags_AppSecret @""
//Bugly
#define kBugly_APPID @"cc78c0c07d"
#define kBugly_AppKey @"09ce7bc6-07e0-4da8-be14-e281d0779b3f"


@implementation BLAppLaunchingProcess

+ (void)launchWithApplication:(UIApplication *)application
                      options:(NSDictionary *)launchOptions
{
    [Bugly startWithAppId:kBugly_APPID];
    [KSNetworkReachability startMonitoring];
    
//    [[AFNetworkReachabilityManager sharedManager] startMonitoring];
//      ;
    [BLUMSocialManager configShareSDK];
//    [IJSSOManager configSMSSDK];
//    [IJDBManager initDatabase];
    
    [self bugtagsSetup];
    
    //    [self umengSetup];
    [DCLoggerConfig setup];
    
    [[NSUserDefaults standardUserDefaults] registerDefaults:@{kUDServerAPIOnline:@(YES)}];
}

+ (void)umengSetup {
    NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
    [MobClick setAppVersion:version];
    [MobClick setCrashReportEnabled:YES];
#ifdef DEBUG
    [MobClick setLogEnabled:YES];
#endif
    // analytics
    UMConfigInstance.appKey = kUMeng_Appkey;
    UMConfigInstance.ePolicy = SEND_INTERVAL;
    //    UMConfigInstance.channelId = [SystemHelper channel];
    [MobClick setLogSendInterval:90];
    [MobClick startWithConfigure:UMConfigInstance];
}

+ (void)bugtagsSetup {
#if DEBUG || ADHOC
    BugtagsOptions *options = [[BugtagsOptions alloc] init];
    options.trackingUserSteps = YES; // 具体可设置的属性请查看 Bugtags.h
    options.trackingConsoleLog = NO;
    options.trackingNetwork = NO;
    options.trackingUserLocation = NO;
    //    options.trackingNetworkURLFilter = @"*wmlives.com*";
    [Bugtags startWithAppKey:kBugtags_Appkey invocationEvent:BTGInvocationEventBubble options:options];
    
#else
    
    
#endif
    
}

@end
